package  brwarner.game.states
{
	import brwarner.radial.Item;
	import brwarner.radial.Menu;
	import flash.events.MouseEvent;
	import brwarner.game.GameState;
	import brwarner.game.Game;
	
	/**
	 * ...
	 * @author Brook Jensen
	 */
	public class MainMenu extends GameState 
	{
		//Main menu
		private var _menu:Menu;
		
		//Menu items
		private var _new:Item, _instructions:Item, _exit:Item;
		
		public function MainMenu( g:Game ) 
		{
			super(g);
			bgcolor = 0xFF0000;
			
			_menu = new Menu( );
			_menu.radius = 200;
			
			_menu.x = width / 2;
			_menu.y = height / 2;
			
			//Start
			_new = new Item();
			_new.addEventListener( MouseEvent.CLICK, newGame );
			_menu.addItem( _new );
			
			//Instructions
			_instructions = new Item();
			_menu.addItem( _instructions );
			
			//Exit
			_exit = new Item();
			_menu.addItem( _exit );
			
			addChild(_menu);
		}
		
		private function newGame( e:MouseEvent )
		{
			game.pushState( new GridState(game) );
		}
		
		override public function resume( ) : void
		{
			_menu.open();
		}
		
	}

}